-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Multidirectional scrolling #1550
[Feature] Multidirectional scrolling #1550
Conversation
2f7c7de
to
9d786ee
Compare
Looking forward to this feature landing. I've been working off this branch for my project and touch events are working as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Nice work 🥳 This was long overdue, thanks!
I left some feedback here and there that I think should help simplfiy some of the code. Let me know what you think!
Thanks a lot for this. I did not look at the code but I did test it in my application and it seems to work fine. I also tried touch control (scrolling horizontally by swiping) and that worked (at least on Windows). |
8e52a6e
to
e0d6fa9
Compare
Fixed thumb "snapping" bug on scrollable when cursor is out of bounds.
e0d6fa9
to
9f85e0c
Compare
I can't test this on Windows atm, seeking assistance 🙏 |
Happy to try, anything specific you have in mind? Just running tests or something more elaborate? |
Just running the |
I tried it today on a Windows laptop (Surface) using touch-screen and it worked beautifully. There is one thing that's a bit weird and I'll try to describe, maybe that's just a feeling though:
This is different than it works in other UIs. There it works as expected: Drag the content and it moves the opposite direction, drag the scrollbar itself and it moves along with your finger. I hope that makes sense? Update: The behavior is the same on horizontal and vertical scrolling so probably nothing to fix in this PR |
A `PartialOrd` implementation is unclear for this type, since it has a position besides its dimensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff @bungoboingo! Looks great 🥳
I made some smaller changes here and there to bring it to the finish line. Let me know what you think, and I believe we can merge!
@lfrancke I believe I have fixed this behavior you mention in 2d00747.
LGTM! Tested the changes and everything appears to be working as intended. TIL shift + mousewheel scrolls horizontally on browsers 🤯 |
@bungoboingo Life changer! You are welcome :D |
This PR adds support for scrolling horizontally in Iced's `Scrollable' widget.
This PR does not create any breaking changes with the current Scrollable API, except for scrollable::snap_to() operation. All other api additions for horizontal scrolling are opt-in!
multi_directional_scrolling_demo_tiny.mov
Tasks:
Scrollable
to include horizontal scrolling capabilitiesKnown issues:
snap_to()
operation on a Scrollable and don't trigger any action which requests a redraw, the operation will not be reflected until the next redraw. I'm pretty sure this is just inherent to operations and not something that occurred due to my changes, but I'm not 100% certain.Implementation Details:
Scrollable
widget in order to prevent instances where the offset of the Scrollable could be adjusted independently of the actual status of the scrollbar, leading to potential out of sync states. I movedScrollbar
intoscrollable::State
asOption<Scrollbar>
for both the x & y scrollbars, and moved some methods that once existed inscrollable::State
intoScrollbar
&Scroller
. This does increase the memsize of the internal Scrollable state very slightly. Let me know what you think of these changes! Definitely open to feedback!!snap_to()
operation to take aVector<f32>
vsf32
to reflect ability to scroll on both axis.Behavior Details:
Very much open to feedback! Let me know what you think, thanks!